package com.ljs.liojbackenduserservice.controller.inner;

import com.ljs.libackendmodel.model.entity.User;
import com.ljs.libackendmodel.model.enums.UserRoleEnum;
import com.ljs.libackendmodel.model.vo.UserVO;
import com.ljs.liojbackendcommon.common.ErrorCode;
import com.ljs.liojbackendcommon.exception.BusinessException;
import com.ljs.liojbackendserviceclient.service.UserFeignClient;
import com.ljs.liojbackenduserservice.service.UserService;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Collection;
import java.util.List;

import static com.ljs.liojbackendcommon.constant.UserConstant.USER_LOGIN_STATE;

/**
 * 该服务仅在内部使用
 */
@RestController()
@RequestMapping("/inner")
public class UserInnerController implements UserFeignClient {
    @Resource
    private UserService userService;
    /**
     * 根据id、获取用户
     *
     * @param userId
     * @return
     */
    @GetMapping("/get/id")
    public User getById(@RequestParam("userId") long userId) {
          return   userService.getById(userId);
    }

    /**
     * 根据id获取用户列表
     *
     * @param idList
     * @return
     */
    @Override
    @GetMapping("/get/ids")
    public List<User> listByIds(@RequestParam("idList") Collection<Long> idList){
            return userService.listByIds(idList);
    }


}
